package lcs.table;


/**
 * The FinderTable indexes the current LCS per each member of each string.
 *
 */
public class FinderTable {
	private TableElement[][] theTable;
	private final String stringX, stringY;

	/**
	 * @param xLength The length of string1
	 * @param yLength The length of string2
	 */
	public FinderTable(String _stringX, String _stringY) {
		this.stringX=_stringX;
		this.stringY=_stringY;
		theTable = new TableElement[stringX.length()][stringY.length()];
	}

	/**
	 * @return The X string.
	 */
	public String getStringX() {
		return stringX;
	}

	/**
	 * @return The Y string.
	 */
	public String getStringY() {
		return stringY;
	}


	/**
	 * Sets the element at the specified x,y coordinate.
	 * 
	 * @param x X value of the element to set.
	 * @param y Y value of the element to set.
	 */
	public void setElementAt(int x, int y , TableElement value) {
		theTable[x][y] = value;
	}

	/**
	 * Returns the element at the specified x,y coordinate.
	 * 
	 * @param x X value of the element to get.
	 * @param y Y value of the element to get.
	 * @return The value of the element.
	 */
	public TableElement getElementAt(int x, int y ) {
		return theTable[x][y];
	}
}
